$('form').on('submit', function (e) {
    e.preventDefault()
    let data = $(this).serialize()
    
    $.ajax({
        type: 'POST',
        url: '/my/user/updatepwd',
        data: data,
        success: function (res) {            
            if (res.status===0) {
                layer.msg(res.message, {
                    time: 2000 //2秒关闭（如果不配置，默认是3秒）
                }, function () {
                    localStorage.removeItem('token')
                   window.parent.location.href='../login.html'
                 }
                )};
            
          }
    })
})
 
let form = layui.form

form.verify({
    pwd: [/^\S{6,12}$/, '密码必须为6-12位'],
    same: function (value) {
        if ($('.newPwd').val()!==value) {
            return '两次输入密码不一致'
        }
    }
})